package com.cn.web.user.vo.company;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cn.dic.annoations.DicAnnoations;
import com.cn.dic.serialize.DicSerialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;

/**
 * description: UserCompanyChangeDO <br>
 * date: 23.7.18 9:26 <br>
 * author: cn_yaojin <br>
 * version: 1.0 <br>
 */
@Setter
@Getter
@Accessors(chain = true)
@TableName(value = "sys_user_company_change")
@ApiModel(value = "供应商申请信息")
public class UserCompanyChangeDO extends UserCompanyDO {

    @ExcelProperty(value = "入驻类型")
    @ApiModelProperty(value = "入驻类型")
    private String userItemType;

    @ExcelIgnore
    @ApiModelProperty(value = "审批时间")
    private String auditTime;

    @ExcelIgnore
    @ApiModelProperty(value = "审批状态")
    private Integer auditStatus;

    @ExcelIgnore
    @ApiModelProperty(value = "审批意见")
    private String auditResult;

    @ExcelIgnore
    private Integer versionFlag;

    @ExcelIgnore
    @TableField(exist = false)
    @ApiModelProperty(value = "审批任务ID")
    private String runTaskId;

    @ExcelIgnore
    @TableField(exist = false)
    private String linkId;

    @ExcelIgnore
    @TableField(exist = false)
    @ApiModelProperty(value = "审核类型")
    private String approveType;

    @ExcelIgnore
    @TableField(exist = false)
    @DicAnnoations(dicType = "userItemType")
    @JsonSerialize(using = DicSerialize.class)
    @ApiModelProperty(value = "入驻类型字典")
    private String userItemTypeTxt;

    public String getUserItemTypeTxt() {
        return userItemType;
    }

    public String getApproveType() {
        if (StringUtils.isNotEmpty(userItemType)) {
            return "供应商入驻申请";
        } else {
            return "企业信息变更申请";
        }
    }
}
